package com.yx.learn.domain;


import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Group entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "tgroup", catalog = "yx_01")
public class Group implements java.io.Serializable {

	// Fields

	private Integer id;
	private Company company;
	private Integer pid;
	private String groupNo;
	private String groupName;
	private Date createTime;
	private String memo;
	private Set<Usergroup> usergroups = new HashSet<Usergroup>(0);
	private Set<Groupauthority> groupauthorities = new HashSet<Groupauthority>(
			0);

	// Constructors

	/** default constructor */
	public Group() {
	}

	/** minimal constructor */
	public Group(Integer id, Company company, Integer pid, String groupNo,
			String groupName, Date createTime) {
		this.id = id;
		this.company = company;
		this.pid = pid;
		this.groupNo = groupNo;
		this.groupName = groupName;
		this.createTime = createTime;
	}

	/** full constructor */
	public Group(Integer id, Company company, Integer pid, String groupNo,
			String groupName, Date createTime, String memo,
			Set<Usergroup> usergroups, Set<Groupauthority> groupauthorities) {
		this.id = id;
		this.company = company;
		this.pid = pid;
		this.groupNo = groupNo;
		this.groupName = groupName;
		this.createTime = createTime;
		this.memo = memo;
		this.usergroups = usergroups;
		this.groupauthorities = groupauthorities;
	}

	// Property accessors
	@Id
	@Column(name = "id", unique = true, nullable = false)
	@GeneratedValue
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "companyID", nullable = false)
	public Company getCompany() {
		return this.company;
	}

	public void setCompany(Company company) {
		this.company = company;
	}

	@Column(name = "pid", nullable = false)
	public Integer getPid() {
		return this.pid;
	}

	public void setPid(Integer pid) {
		this.pid = pid;
	}

	@Column(name = "groupNo", nullable = false, length = 20)
	public String getGroupNo() {
		return this.groupNo;
	}

	public void setGroupNo(String groupNo) {
		this.groupNo = groupNo;
	}

	@Column(name = "groupName", nullable = false, length = 64)
	public String getGroupName() {
		return this.groupName;
	}

	public void setGroupName(String groupName) {
		this.groupName = groupName;
	}

	@Column(name = "createTime", nullable = false, length = 0)
	public Date getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Column(name = "memo", length = 200)
	public String getMemo() {
		return this.memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "group")
	public Set<Usergroup> getUsergroups() {
		return this.usergroups;
	}

	public void setUsergroups(Set<Usergroup> usergroups) {
		this.usergroups = usergroups;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "group")
	public Set<Groupauthority> getGroupauthorities() {
		return this.groupauthorities;
	}

	public void setGroupauthorities(Set<Groupauthority> groupauthorities) {
		this.groupauthorities = groupauthorities;
	}

}